package abstractgame;

import java.awt.Image;

public abstract class GamePiece {

	// Constants to represent piece color.
	protected final int PIECE_COLOR_WHITE = 0;
	protected final int PIECE_COLOR_BLACK = 1;
	// The color of the piece.
	protected int pieceColor;
	// The state to which the piece belongs.
	protected GameState state;
	/**
	 * Constructor for connecting to the state and setting position.
	 * 
	 */
	protected GamePiece(GameState state,int[] pos) {
		this.state = state;
		this.pos[0] = pos[0];
		this.pos[1] = pos[1];
	}
	/**
	 * Can the piece move or not?
	 */
	protected boolean canMove;
	
	/**
	 * The image, representing the piece, to be drawn on the board
	 */
	protected Image img;
	
	/**
	 * The position of the piece, pos[0] = x, pos[1] = y
	 */
	protected int[] pos = new int[2];

	/**
	 * Returns an array with the allowed mves set to true.
	 * 
	 * @return Array with allowed moves set to true
	 */
	public abstract boolean[][] allowedMoves();

	/**
	 * Getter for CanMove field.
	 * 
	 * @return true if the piece is allowed to move, false otherwise
	 **/
	public boolean getCanMove() {
		return canMove;
	}

	/**
	 * @return the img
	 */
	public Image getImg() {
		return img;
	}

	/**
	 * @return the pos
	 */
	public int[] getPos() {
		return pos;
	}
	/**
	 * 
	 */
	public int getColor() {
		return pieceColor;
	}

}
